package com.wanxi.service.Impl;

import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.wanxi.mapper.SuggestMapper;
import com.wanxi.model.SuggestModel;
import com.wanxi.service.SuggestService;
import org.springframework.amqp.core.Message;
import org.springframework.amqp.rabbit.core.RabbitTemplate;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.nio.charset.StandardCharsets;

/**
 * @author Li
 * @Date 2023/7/18 15:58
 */
@Service
public class SuggestServiceImpl extends ServiceImpl<SuggestMapper, SuggestModel> implements SuggestService {
    @Autowired
    RabbitTemplate rabbitTemplate;
    @Override
    public String sendMessage(String message) {
        Message message1 = new Message(message.getBytes(StandardCharsets.UTF_8));
        rabbitTemplate.send(Constant.MQ_EXCHANGE,Constant.MQ_BINDING_KEY,message1);
        return message;
    }
}
